Base class for any graphical component. More...
Public Member Functions | |
| Component () | |
| virtual | ~Component () |
| Layout * | getLayout () const |
| nkMaths::Point | getPositionInParent () const |
| nkMaths::Point | getPositionInScreen () const |
| int | getWidth () const |
| int | getHeight () const |
| nkMaths::Rectangle | getArea () const |
| virtual nkMaths::Point | getBorderExtents () const |
| virtual int | getLayoutAllowedWidth () const |
| virtual int | getLayoutAllowedHeight () const |
| virtual int | getLayoutAllowedOffsetX () const |
| virtual int | getLayoutAllowedOffsetY () const |
| bool | isInitialized () const |
| Component * | getParentComponent () const |
| COMPONENT_TYPE | getComponentType () const |
| const char * | getComponentName () const |
| bool | getVisibility () const |
| virtual const char * | getLabel () const |
| void * | getData () const |
| bool | isEnabled () const |
| bool | isForegroundWindow () const |
| unsigned int | getZDepth () const |
| virtual Layout * | setLayout (LAYOUT_TYPE layoutType) |
| virtual void | setPositionInParent (nkMaths::Point position) |
| virtual void | setPositionInScreen (nkMaths::Point position) |
| virtual void | setSize (int width, int height) |
| virtual void | setWidth (int width) |
| virtual void | setHeight (int height) |
| void | setMinSize (unsigned int width, unsigned int height) |
| void | setMaxSize (unsigned int width, unsigned int height) |
| void | setRatio (float widthOverHeight) |
| virtual void | setArea (nkMaths::Rectangle area) |
| virtual void | setParentComponent (Component *parent, bool makeItVisible=true) |
| virtual void | setLabel (const std::string_view &label) |
| void | setComponentName (const std::string_view &name) |
| virtual void | setVisibility (bool value) |
| void | setData (void *data) |
| void | setEnabled (bool value) |
| void | addChild (Component *child, bool makeItVisible=true) |
| void | removeChild (Component *child) |
| void | removeChild (unsigned int index) |
| Component * | getChild (unsigned int index) |
| unsigned int | getChildIndex (Component *child) |
| void | unloadWithChildren () |
| void | loadWithChildren () |
| void | updateZDepth () |
| void | bringToForeground () |
| void | focusWindow () |
| nkMaths::Point | getCoordRelativeFromAbsolute (const nkMaths::Point &absCoords) |
| nkMaths::Point | getCoordAbsoluteFromRelative (const nkMaths::Point &relCoords) |
| virtual void | load ()=0 |
| virtual void | unload ()=0 |
| virtual void | updateWindow () |
| void | onSized () |
| ContextMenu * | createContextMenu () |
| ContextMenu * | getCurrentContextMenu () |
| void | shutContextMenu () |
| virtual void | exportClassToTree (nkExport::Node *rootNode) override |
| virtual void | exportIntrospection (nkExport::Node *rootNode) |
| virtual void | importClassFromTree (nkExport::Node *rootNode) override |
Public Member Functions inherited from nkExport::Exportable | |
| Exportable () | |
| virtual | ~Exportable () |
Base class for any graphical component.
| nkWinUi::Component::Component | ( | ) |
Constructor.
|
virtual |
Destructor.
| Layout* nkWinUi::Component::getLayout | ( | ) | const |
| nkMaths::Point nkWinUi::Component::getPositionInParent | ( | ) | const |
| nkMaths::Point nkWinUi::Component::getPositionInScreen | ( | ) | const |
| int nkWinUi::Component::getWidth | ( | ) | const |
| int nkWinUi::Component::getHeight | ( | ) | const |
| nkMaths::Rectangle nkWinUi::Component::getArea | ( | ) | const |
|
virtual |
|
virtual |
Reimplemented in nkWinUi::GroupBox.
|
virtual |
Reimplemented in nkWinUi::GroupBox.
|
virtual |
Reimplemented in nkWinUi::GroupBox.
|
virtual |
Reimplemented in nkWinUi::GroupBox.
| bool nkWinUi::Component::isInitialized | ( | ) | const |
| Component* nkWinUi::Component::getParentComponent | ( | ) | const |
| COMPONENT_TYPE nkWinUi::Component::getComponentType | ( | ) | const |
| const char* nkWinUi::Component::getComponentName | ( | ) | const |
| bool nkWinUi::Component::getVisibility | ( | ) | const |
|
virtual |
| void* nkWinUi::Component::getData | ( | ) | const |
| bool nkWinUi::Component::isEnabled | ( | ) | const |
| bool nkWinUi::Component::isForegroundWindow | ( | ) | const |
| unsigned int nkWinUi::Component::getZDepth | ( | ) | const |
|
virtual |
Sets the component's layout type by instantiating a new layout, and returns it for populating.
| layoutType | The type of layout the component should instantiate. |
Reimplemented in nkWinUi::TabWindow.
|
virtual |
Change the component's position, relative to the parent.
| position | The position to assign, in pixels. |
|
virtual |
Change the component's position, relative to screen (absolute).
| position | The position to assign, in pixels. |
|
virtual |
Change the component's size.
| width | The width to assign, in pixels. |
| height | The height to assign, in pixels. |
|
virtual |
Change the component's width.
| width | The width to assign, in pixels. |
|
virtual |
Change the component's height.
| height | The height to assign, in pixels. |
| void nkWinUi::Component::setMinSize | ( | unsigned int | width, |
| unsigned int | height | ||
| ) |
Assign a minimum size the component should have.
| width | The minimum width possible, in pixels. -1 symbolizes "no limit". |
| height | The minimum height possible, in pixels. -1 symbolizes "no limit". |
| void nkWinUi::Component::setMaxSize | ( | unsigned int | width, |
| unsigned int | height | ||
| ) |
Assign a maximum size the component should have.
| width | The maximum width possible, in pixels. -1 symbolizes "no limit". |
| height | The maximum height possible, in pixels. -1 symbolizes "no limit". |
| void nkWinUi::Component::setRatio | ( | float | widthOverHeight | ) |
Assign a ratio the component has to respect.
| widthOverHeight | The ratio, as width / height. |
|
virtual |
Assign an area the component should cover.
| area | The area, in pixels, to cover. |
|
virtual |
Changes the parent component.
| parent | The parent component to assign. |
| makeItVisible | If the component should be made visible within the parent, if the parent is visible. |
Reimplemented in nkWinUi::Popup.
|
virtual |
Changes the label of the component. This can be the title of a nkWinUi::Window, the txt of a nkWinUi::EditBox...
| label | The text to assign. |
| void nkWinUi::Component::setComponentName | ( | const std::string_view & | name | ) |
Sets the component name.
| name | The name to assign. |
|
virtual |
Sets whether this component should be visible.
| value | If the component should be visible on screen (true) or not (false). |
| void nkWinUi::Component::setData | ( | void * | data | ) |
Attach user data to the component.
| data | The user data to attach to the component. |
| void nkWinUi::Component::setEnabled | ( | bool | value | ) |
Sets whether the component is enabled or not.
| value | If it is enabled (true) or not (false). |
| void nkWinUi::Component::addChild | ( | Component * | child, |
| bool | makeItVisible = true |
||
| ) |
Add a child component.
| child | The component that should become a child. |
| makeItVisible | If the child component has to become visible if the parent is also visible. |
| void nkWinUi::Component::removeChild | ( | Component * | child | ) |
Removes a child.
| child | The child component that should not be a child anymore. |
| void nkWinUi::Component::removeChild | ( | unsigned int | index | ) |
Removes a child.
| index | The index of the child component, in the children list, that should be removed. |
| Component* nkWinUi::Component::getChild | ( | unsigned int | index | ) |
Returns a child component.
| index | The child component at given index, in the children list. |
| unsigned int nkWinUi::Component::getChildIndex | ( | Component * | child | ) |
Returns the index in the list of one child component.
| child | The child component chich index is needed. |
| void nkWinUi::Component::unloadWithChildren | ( | ) |
Unloads the component along with its children.
| void nkWinUi::Component::loadWithChildren | ( | ) |
Loads the component along with its children.
| void nkWinUi::Component::updateZDepth | ( | ) |
Updates the depth of the component. Computed from the component's hierarchy.
| void nkWinUi::Component::bringToForeground | ( | ) |
Brings the component to the foreground.
| void nkWinUi::Component::focusWindow | ( | ) |
Puts the component into focus.
| nkMaths::Point nkWinUi::Component::getCoordRelativeFromAbsolute | ( | const nkMaths::Point & | absCoords | ) |
Converts given coordinates from absolute in screen to relative to the component.
| absCoords | The absolute coordinates to convert. |
| nkMaths::Point nkWinUi::Component::getCoordAbsoluteFromRelative | ( | const nkMaths::Point & | relCoords | ) |
Converts given coordinates from relative to the component to absolute in screen.
| relCoords | The relative coordinates to convert. |
|
pure virtual |
Loads the component. This will trigger the initialization of the component in the windowing system.
|
pure virtual |
Unloads the component. This will make the component release resources from the windowing system.
|
virtual |
Update the window for changes that could have occurred.
| void nkWinUi::Component::onSized | ( | ) |
Component's callback for resize events.
| ContextMenu* nkWinUi::Component::createContextMenu | ( | ) |
| ContextMenu* nkWinUi::Component::getCurrentContextMenu | ( | ) |
| void nkWinUi::Component::shutContextMenu | ( | ) |
Shuts and delete current context menu.
|
overridevirtual |
A basic exporting capability.
| rootNode | The root of the tree to export into. |
Implements nkExport::Exportable.
|
virtual |
A basic exporting capability, for components inheriting. Components inheriting this class should rather reimplement this function to export their internal data.
| rootNode | The root of the tree to export into. |
Reimplemented in nkWinUi::TreeView, nkWinUi::ListBox, nkWinUi::TabWindow, nkWinUi::ComboBox, nkWinUi::FileExplorer, nkWinUi::GraphicsWindow, nkWinUi::Static, nkWinUi::EditBox, nkWinUi::Window, and nkWinUi::LogWin.
|
overridevirtual |
A basic importing capability.
| rootNode | The root of the tree to import from. |
Implements nkExport::Exportable.
Reimplemented in nkWinUi::TreeView, nkWinUi::ListBox, nkWinUi::TabWindow, nkWinUi::ComboBox, nkWinUi::FileExplorer, nkWinUi::GraphicsWindow, nkWinUi::Static, nkWinUi::EditBox, nkWinUi::Window, and nkWinUi::LogWin.